Skip to content

Commit

Permalink
BAGEL: standardize parse code variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed May 15, 2024
1 parent a8f77dd commit 80288a0
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 90 deletions.
6 changes: 3 additions & 3 deletions engines/bagel/baglib/button_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ ParseCodes CBagButtonObject::setInfo(CBagIfstream &istr) {
// No match return from function
//
default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
nObjectUpdated = true;
} else { // rc==UNKNOWN_TOKEN
if (nObjectUpdated)
Expand Down
6 changes: 3 additions & 3 deletions engines/bagel/baglib/character_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,12 @@ ParseCodes CBagCharacterObject::setInfo(CBagIfstream &istr) {

// No match return from function
default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down
6 changes: 3 additions & 3 deletions engines/bagel/baglib/command_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,12 @@ ParseCodes CBagCommandObject::setInfo(CBagIfstream &istr) {
// No match return from function
//
default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down
6 changes: 3 additions & 3 deletions engines/bagel/baglib/dossier_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ ParseCodes CBagDossierObject::setInfo(CBagIfstream &istr) {
// no match return from function
//
default:
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down
14 changes: 7 additions & 7 deletions engines/bagel/baglib/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,10 @@ ParseCodes CBagExpression::setInfo(CBagIfstream &istr) {
// CHECKME: Should we put this string in a debugC at the end of the function? (Currently unused)
CBofString errStr(errBuffer, 256);

ParseCodes rc = PARSING_DONE;
ParseCodes parseCode = PARSING_DONE;
bool doneFl = false;

while (!doneFl && rc == PARSING_DONE) {
while (!doneFl && parseCode == PARSING_DONE) {
istr.eatWhite();
int ch = istr.peek();
switch (ch) {
Expand Down Expand Up @@ -599,11 +599,11 @@ ParseCodes CBagExpression::setInfo(CBagIfstream &istr) {

istr.eatWhite();
ch = istr.peek();
while ((ch != ')') && rc == PARSING_DONE) {
while ((ch != ')') && parseCode == PARSING_DONE) {
OPERATION curOper;
getOperatorFromStream(istr, curOper);
if (curOper == OP_NONE) {
rc = UNKNOWN_TOKEN;
parseCode = UNKNOWN_TOKEN;
errStr = "Bad operator:";
break;
}
Expand Down Expand Up @@ -649,18 +649,18 @@ ParseCodes CBagExpression::setInfo(CBagIfstream &istr) {
// FIXME: Is this intentional?
// fallthrough
default:
rc = UNKNOWN_TOKEN;
parseCode = UNKNOWN_TOKEN;
break;
}
}

if (rc != PARSING_DONE) {
if (parseCode != PARSING_DONE) {
parseAlertBox(istr, "Error in expression:", __FILE__, __LINE__);
}

istr.eatWhite();

return rc;
return parseCode;
}


Expand Down
13 changes: 6 additions & 7 deletions engines/bagel/baglib/expression_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ CBagExpressionObject::CBagExpressionObject() : CBagObject() {
}

CBagExpressionObject::~CBagExpressionObject() {
if (_expression != nullptr) {
delete _expression;
_expression = nullptr;
}
delete _expression;
_expression = nullptr;

CBagObject::detach();
}

Expand Down Expand Up @@ -92,12 +91,12 @@ ParseCodes CBagExpressionObject::setInfo(CBagIfstream &istr) {
// No match return from function
//
default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down
16 changes: 8 additions & 8 deletions engines/bagel/baglib/link_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CBofRect CBagLinkObject::getRect() {
ParseCodes CBagLinkObject::setInfo(CBagIfstream &istr) {
bool objectUpdatedFl = false;

ParseCodes parsingCode = PARSING_DONE;
ParseCodes returnCode = PARSING_DONE;
bool doneFl = false;

while (!doneFl && !istr.eof()) {
Expand Down Expand Up @@ -134,20 +134,20 @@ ParseCodes CBagLinkObject::setInfo(CBagIfstream &istr) {
// No match return from function
//
default: {
ParseCodes rc = CBagObject::setInfo(istr);
ParseCodes parseCode = CBagObject::setInfo(istr);

if (rc == PARSING_DONE) {
parsingCode = PARSING_DONE;
if (parseCode == PARSING_DONE) {
returnCode = PARSING_DONE;
doneFl = true;

} else if (rc == UPDATED_OBJECT) {
} else if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;

} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
parsingCode = UPDATED_OBJECT;
returnCode = UPDATED_OBJECT;
else
parsingCode = UNKNOWN_TOKEN;
returnCode = UNKNOWN_TOKEN;

doneFl = true;
}
Expand All @@ -156,7 +156,7 @@ ParseCodes CBagLinkObject::setInfo(CBagIfstream &istr) {
}
}

return parsingCode;
return returnCode;
}


Expand Down
24 changes: 12 additions & 12 deletions engines/bagel/baglib/log_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,12 @@ ParseCodes CBagLogMsg::setInfo(CBagIfstream &istr) {
}

default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
nObjectUpdated = true;
} else { // rc==UNKNOWN_TOKEN
if (nObjectUpdated)
Expand Down Expand Up @@ -634,12 +634,12 @@ ParseCodes CBagLogSuspect::setInfo(CBagIfstream &istr) {
}

default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down Expand Up @@ -871,12 +871,12 @@ ParseCodes CBagEnergyDetectorObject::setInfo(CBagIfstream &istr) {
}

default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
objectUpdatedFl = true;
} else { // rc==UNKNOWN_TOKEN
if (objectUpdatedFl)
Expand Down Expand Up @@ -1043,12 +1043,12 @@ ParseCodes CBagLogClue::setInfo(CBagIfstream &istr) {
}

default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
nObjectUpdated = true;
} else { // rc==UNKNOWN_TOKEN
if (nObjectUpdated)
Expand Down
6 changes: 3 additions & 3 deletions engines/bagel/baglib/movie_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,12 @@ ParseCodes CBagMovieObject::setInfo(CBagIfstream &istr) {
// No match return from funtion
//
default: {
ParseCodes rc = CBagObject::setInfo(istr);
if (rc == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
nObjectUpdated = true;
} else { // rc==UNKNOWN_TOKEN
if (nObjectUpdated)
Expand Down
24 changes: 12 additions & 12 deletions engines/bagel/baglib/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool CBagObject::runObject() {
}

ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
ParseCodes rc = UNKNOWN_TOKEN;
ParseCodes parseCode = UNKNOWN_TOKEN;

while (!istr.eof()) {
istr.eatWhite();
Expand All @@ -171,7 +171,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// =filename.ext
//
case '=': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
char szLocalBuff[256];
szLocalBuff[0] = 0;
CBofString s(szLocalBuff, 256);
Expand All @@ -184,7 +184,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// { menu objects .... } - Add menu items
//
case '{': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
if (!_pMenu) {
_pMenu = new CBagMenu;
if (_pMenu == nullptr)
Expand All @@ -209,7 +209,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// ^id; - Set id
//
case '^': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
char c = (char)istr.peek();
if (Common::isDigit(c)) {
int nId;
Expand All @@ -228,7 +228,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// *state; - Set state
//
case '*': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
int nState;
getIntFromStream(istr, nState);
setState(nState);
Expand All @@ -238,7 +238,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// %cusror; - Set cursor
//
case '%': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
int nCursor;
getIntFromStream(istr, nCursor);
setOverCursor(nCursor);
Expand All @@ -248,7 +248,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
// [left,top,right,bottom] - Set position
//
case '[': {
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
CBofRect r;
istr.putBack();
getRectFromStream(istr, r);
Expand All @@ -263,7 +263,7 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
case 'I': {
if (istr.peek() != 'S') {
istr.putBack();
return rc;
return parseCode;
break;
}
char szLocalBuff[256];
Expand Down Expand Up @@ -314,10 +314,10 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
if (!b)
putbackStringOnStream(istr, " NOT ");
putbackStringOnStream(istr, "IS ");
return rc;
return parseCode;
break;
}
rc = UPDATED_OBJECT;
parseCode = UPDATED_OBJECT;
break;
}
//
Expand All @@ -332,11 +332,11 @@ ParseCodes CBagObject::setInfo(CBagIfstream &istr) {
//
default:
istr.putBack();
return rc;
return parseCode;
}
}

return rc;
return parseCode;
}

void CBagObject::onLButtonUp(uint32 nFlags, CBofPoint * /*xPoint*/, void *) {
Expand Down
8 changes: 4 additions & 4 deletions engines/bagel/baglib/rp_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ ParseCodes CBagRPObject::setInfo(CBagIfstream &istr) {
// complain violently.
if (_pVarObj == nullptr) {
reportError(ERR_UNKNOWN, "Invalid Residue Print Variable=%s",
sStr.getBuffer());
sStr.getBuffer());
return UNKNOWN_TOKEN;
}
} else {
Expand All @@ -369,12 +369,12 @@ ParseCodes CBagRPObject::setInfo(CBagIfstream &istr) {
break;

default: {
ParseCodes rc;
if ((rc = CBagObject::setInfo(istr)) == PARSING_DONE) {
ParseCodes parseCode = CBagObject::setInfo(istr);
if (parseCode == PARSING_DONE) {
return PARSING_DONE;
}

if (rc == UPDATED_OBJECT) {
if (parseCode == UPDATED_OBJECT) {
nObjectUpdated = true;
} else { // rc==UNKNOWN_TOKEN
if (nObjectUpdated)
Expand Down

0 comments on commit 80288a0

Please sign in to comment.